import { getToken, setToken, removeToken } from '@/utils/auth'
import {sendCharacterPrompt} from "@/api/app/simulator.js";

const usePersonalityStore = defineStore(
    'personality',
    {
        state:() => ({
            token: getToken(),
            personalityId: '',
        }),
        actions: {
            //添加人设描述
            sendPrompt(uuid, message){
                return new Promise((resolve, reject) => {
                    sendCharacterPrompt(uuid, message).then(res => {
                        if(res.data.personalityId !== -1){
                            this.personalityId = res.data.personalityId;
                        }
                        resolve(res)
                    }).catch(error => {
                        reject(error)
                    })
                })
            }
        }
    }
)

export default usePersonalityStore